package com.sikaryofficial.system.api;

import com.sikaryofficial.common.core.constant.ServiceNameConstants;
import com.sikaryofficial.common.core.web.domain.AjaxResult;
import com.sikaryofficial.system.api.domain.SysUser;
import com.sikaryofficial.system.api.factory.RemoteProfileFallbackFactory;
import com.sikaryofficial.system.api.model.SysUserEmailReq;
import com.sikaryofficial.system.api.model.SysUserNickNameReq;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

/**
 * 用户服务
 *
 * @author qinjinyuan
 */
@FeignClient(contextId = "remoteProfileService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteProfileFallbackFactory.class)
public interface RemoteProfileService {

    /**
     * 个人背景图上传
     *
     * @param file 文件信息
     * @return 结果
     */
    @PostMapping(value = "/user/profile/backImg", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    AjaxResult updateBackImg(@RequestPart(value = "file") MultipartFile file, @RequestHeader("deviceId") String deviceId, @RequestHeader("channel") String channel);

    /**
     * 头像上传-更新
     *
     * @param file 文件信息
     * @return 结果
     */
    @PostMapping(value = "/user/profile/avatar", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    AjaxResult updateAvatar(@RequestPart(value = "avatarfile") MultipartFile file, @RequestHeader("deviceId") String deviceId, @RequestHeader("channel") String channel);

    /**
     * 邮箱更新
     *
     * @param req
     * @return
     */
    @PostMapping("/user/profile/updateEmail")
    AjaxResult updateEmail(@RequestBody SysUserEmailReq req, @RequestHeader("deviceId") String deviceId, @RequestHeader("channel") String channel);

    /**
     * 修改昵称
     *
     * @param req
     * @return
     */
    @PostMapping("/user/profile/updateNickName")
    AjaxResult updateNickName(@RequestBody SysUserNickNameReq req);

    /**
     * 个人资料更新
     *
     * @param user
     * @return
     */
    @PutMapping("/user/profile")
    AjaxResult updateProfile(@RequestBody SysUser user, @RequestHeader("deviceId") String deviceId, @RequestHeader("channel") String channel);


}
